package org.example.testcontroller;

import com.bianmaba.spring.security.util.SecurityUtils;
import org.example.bean.entity.authorization.User;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;

/**
 * @program: example-spring-boot-extend
 * @description:
 * @author: Chenjiabin
 * @create: 2019/4/10 18:01
 **/
@Controller
@RequestMapping("simple")
public class SimpleController {
    @RequestMapping("save")
    public Object save(User user) {
        return new ModelAndView("admin/save", "data", user);
    }


    @RequestMapping("read")
    public Object read(User user, Model model) {
        List<String> xxxx = SecurityUtils.getCurrentAuthorities();
        model.addAttribute("data", user);
        return "admin/read";
    }
}
